<?php

class Application_Model_Os extends Zend_Db_Table_Abstract
{   
    protected $_name = "kp_os"; //Ten bang
    protected $_primary = "os_id"; //Khoa chinh
    protected $db;
    //Cac truong du lieu
    var $os_id;
    var $os_name;
    var $os_status=0;
    
    //Ham khoi tao
    public function __construct(){
    	$this->db = Zend_Registry::get('db');
    }
    
    //Get all user
    public function getAll(){
    	$query = $this->db->select();
    	$query->from($this->_name);
    	$query->order('os_name');
    	return $this->db->fetchAll($query);
    }
    
    //Them mới user
    public function insertOs(){
    	$data = array(
    			'os_name' => $this->os_name,
    			'os_status'=>$this->os_status,
    	);
    	//var_dump($data); die;
    	return $this->db->insert($this->_name,$data);
    }
    //Xoa theo os_id
    public function deleteID($id){        
        $where = array('os_id =?'=>$id);
        return $this->db->delete($this->_name,$where);
    }


}

